#!/usr/bin/expect

set timeout 1
set ip [lindex $argv 0]
set user [lindex $argv 1]
#开启子进程
spawn ssh ${user}@${ip}
expect "*yes/no*" {send "yes\r"}\
		"*$*" {send "\r"}\
		"*No such file*" { exit 1}\
		"*not known*" { exit 1}\
        "*refused*" { exit 1}
expect eof
exit